//蒸发
var evaporationChartOption = {
    chart: {
        zoomType: 'x'
    },
    exporting:{
    	enabled : false
    },
    xAxis: {
        type: 'datetime',
        dateTimeLabelFormats: {
            day: '%m-%d',
            week: '%m-%d',
            month:'%y-%m-%d',
            year:'%y-%m-%d'
        }
    },
    yAxis: {
    	title: {
         text: '蒸发量(mm)'
        },
        lineWidth : 1
    },
    credits:{
    	enabled:false
    },
    legend: {
        verticalAlign: 'bottom'
    },
    plotOptions:{
    	series:{
    		marker: {
                enabled: false
            }
    	}
    },
    tooltip:{
    	shared: true,
    	crosshairs: true,
    	dateTimeLabelFormats: {
    		second:'%m-%d %H:%M',
    		minute:'%m-%d %H:%M',
    		hour:'%m-%d %H:%M',
            day: '%m-%d',
            week: '%m-%d',
            month:'%y-%m-%d',
            year:'%y-%m-%d'
        }
    }
}

function buildEvaporationChart(windowVals,tabPanel){
	var id = tabPanel.attr('id');
	var bTm = windowVals.startTime;
	var eTm = windowVals.endTime;
	var stcd = tabPanel.data('stcd');
	var splitBTm = bTm.split('-');
	var startDate = new Date(splitBTm[0],splitBTm[1] - 1,splitBTm[2]);
	var chartParams = {};
	if(id == 'day'){
		chartParams.url = '../gis/EvaporationScreen.json?method=getSingleStatDayProcessByGisJs';
		chartParams.chartTitle = '逐日8时蒸发过程';	
		chartParams.seriesData = [
			{type: 'column',name: '蒸发',color : 'green',dataVal : 'vals'}
		];
	}
	chartParams.subChartTitle = bTm + '至' + eTm;
	var sendParams = {bTm:bTm,eTm:eTm,stcd:stcd,dxn:2011,r:new Date().getTime()};	
	buildChart(tabPanel,startDate,evaporationChartOption,chartParams,sendParams,id,'evaporation');
}

function buildEvaporationTable(windowVals,tabPanel){
	var id = tabPanel.attr('id');
	var stcd = tabPanel.data('stcd');
	var startTime = windowVals.startTime;
	var endTime = windowVals.endTime;

	var sendParams = {bTm:startTime,eTm:endTime,stcd:stcd,dxn:2011,r:new Date().getTime()};
	var params = $.extend({},windowVals);
	if(id == 'day'){
		params.csvDataHeaders = '序号,日期,蒸发量(mm)';
		params.dataKeys = ['tm','val'];
		params.chartDataTableUrl = '../gis/EvaporationScreen.json?method=getSingleStatDayProcess';
	}
	buildTable(tabPanel,params,sendParams,id,'evaporation');
}

function windowEvaporationQuery(event){
	var showTabPanel = event.data.panel;
	var windowVals = getWindowVals(showTabPanel,true,false);
	buildEvaporationChart(windowVals,showTabPanel);
	buildEvaporationTable(windowVals,showTabPanel);
}
